package com.tx.service.impl;

import com.tx.dao.TypeDao;
import com.tx.entity.Type;
import com.tx.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: tcx
 * @description: 博客类型业务层实现类
 * @Date: 2019/11/5
 **/
@Service
public class TypeServiceImpl implements TypeService {

    @Autowired
    private TypeDao typeDao;
    /* *
     * @description:  添加博客类型
     * @author tcx
     * @date 2019/11/5
     * @param type
     * @return void
     */
    public Integer add(Type type) {
        return  typeDao.insert(type);
    }
    /* *
     * @description: 修改博客类型
     * @author tcx
     * @date 2019/11/5
     * @param type
     * @return void
     */
    public Integer edit(Type type) {
        return typeDao.update(type);
    }
    /* *
     * @description: 删除博客类型
     * @author tcx
     * @date 2019/11/5
     * @param tId
     * @return void
     */
    public Integer remove(Integer tId) {
        return  typeDao.delete(tId);
    }
    /* *
     * @description:  根据id获取博客类型
     * @author tcx
     * @date 2019/11/5
     * @param tId
     * @return com.tx.entity.Type
     */
    public Type get(Integer tId) {
        return typeDao.select(tId);
    }
    /* *
     * @description: 获取所有博客类型
     * @author tcx
     * @date 2019/11/5
     * @param
     * @return java.util.List<com.tx.entity.Type>
     */
    public List<Type> getAll(Type type) {
        return typeDao.selectAll(type);
    }
    public Integer getTotal(Map<String, Object> map) {
        return typeDao.getTotal(map);
    }

    public List<Type> list(Map<String, Object> map) {
        return typeDao.selectTypeKey(map);
    }

    public Integer state(Type type) {
        return typeDao.update(type);
    }
}
